<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        .box {
            width: 200px;
            height: 200px;
            border: 1px solid #000;
        }
        
        .son {
            width: 200px;
            height: 200px;
            background-color: pink;
        }
    </style>
</head>

<body>
    <div class="box">
        <div class="son"></div>
    </div>
    <script>
        var div = document.querySelector('.box')
        console.log(div.offsetWidth);
        console.log(div.offsetHeight);
        var son = document.querySelector('.son')
        console.log(son.offsetWidth);
        console.log(son.offsetHeight);
    </script>
</body>

</html>